package com.maruti.otterapi.authorinfo;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import com.maruti.otterapi.Otter4JavaException;
import com.maruti.otterapi.TopsyConfig;
import com.maruti.otterapi.TopsyConstants;
import com.maruti.otterapi.TopsyInvoker;
import com.maruti.otterapi.search.Post;
import com.maruti.otterapi.search.SearchResponse;

public class AuthorInfo {

	private TopsyConfig topsyConfig;

	public TopsyConfig getTopsyConfig() {
		return topsyConfig;
	}

	public void setTopsyConfig(TopsyConfig topsyConfig) {
		this.topsyConfig = topsyConfig;
	}

	/**
	 * @param query
	 * @param startPage
	 * @param maxNoOfPages
	 * @param searchTimeLine
	 *            : Time window for results. (Options: dynamic - will pick the
	 *            most relevant window. Possible responses are 1-23 hours or
	 *            1-100 days. (For example: h6 or d10). h last hour, d last day,
	 *            w last week, m last month, a all time. (DEPRECATED: auto -
	 *            automatically pick the most relevant window. This will return
	 *            one of the standard h,d,w,m,a window values.).
	 * @param exclude
	 *            : comma seperated list of Strings to exclude from results.
	 * @return
	 * @throws Otter4JavaException
	 */
	public AuthorInfoResponse authorInfo(String query) throws Otter4JavaException {
		TopsyInvoker invoker = new TopsyInvoker();
		invoker.setTopsyConfig(topsyConfig);

		query = query.replaceAll("\\s", "%20");

		AuthorInfoResponse response = null;

		response = (AuthorInfoResponse) invoker.fetchData(
				TopsyConstants.authorInfoBaseURL + query, "authorInfo");

		return response;
	}

}
